package Hot100.leetcode.editor.cn.code.二分;
//Java：寻找峰值
public class FindPeakElement{
    public static void main(String[] args) {
        Solution solution = new FindPeakElement().new Solution();
    }
    //leetcode submit region begin(Prohibit modification and deletion)
class Solution {
    public int findPeakElement(int[] nums) {
        int left = 0;
        int right = nums.length;
        while(left < right){
            int mid = (left+right) >> 1;
            if(nums[mid] > nums[mid+1]){
                right = mid;
            }else {
                left = mid+1;
            }
        }
        return left; // Changed from return right to return left as per the binary search logic
    }
}
//leetcode submit region end(Prohibit modification and deletion)

}